home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
misc
/
football
/
user
/
flipschedule.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-11-29
|
4KB
|
181 lines
/* Mode=Run */
/* ***********************************************************************
FLIPSCHEDULE PROGRAM FOR FOOTBALL REXX SUITE
----------------------------------------------
Copyright Mark Naughton 1996
Version Date History
--------------------------------------------------------------------------
1.0 270996 First release.
1.1 121196 Added to Football as a callable component. Amended for
different leagues. Removed messages.
131196 Added checks for files - if not found, exits without
a message.
241196 Now called as an External script. Added info messages.
1.2 050599 Updated to only allow non-scheduled leagues to be
flipped and printed.
250899 Added error msg to file checks.
280899 Converted to use locale. Some error messages, before
reading the locale, will still be in English.
**************************************************************************
Procedure
---------
1. Check files exist. Read '.df' file for schedule info.
2. If scheduled, exit with message. Open Learn file and output file.
3. Read from Learn, then flip the home and away teams, reset the scores
to 'not_played' and then write to output file.
4. Close files and end. When finished this file can then be printed off
and it'll make entering data into GAMEPLAY much easier.
************************************************************************** */
parse arg league_file
league_file = "Data/" || league_file
version = 1
input_file = '.sflearn'
input2_file = '.df'
output_file = '.sflisting'
not_played = '__ __'
separator = '*'
autosched = "*AUTOSCHD="
autos = 0
if open(datafile,"Data/Football.locale",'r') then do
line = readln(datafile)
locdir = strip(line)
close(datafile)
end
else do
say
say "ERROR : (FlipSchedule)"
say
say "Cannot read 'Data/Football.locale' for the locale settings."
exit
end
locdir = locdir"User/FlipSchedule.data"
if open(datafile,"ENV:FootballRXPath",'r') then do
line = readln(datafile)
rxdir = strip(line)
close(datafile)
end
else
rxdir = "SYS:Rexxc/"
if exists(locdir) > 0 then do
address command rxdir'rx 'locdir
VarCount = getclip('VarCount')
do i = 1 to VarCount
interpret getclip('var.'i)
end
end
else do
say
say "ERROR : (FlipSchedule)"
say
say "Cannot find '"locdir"' to read locale settings."
exit
end
if exists(league_file || input_file) = 0 then do
say
say fs_error
say
say fs_one"'"league_file || input_file"'."
exit
end
if exists(league_file || input2_file) = 0 then do
say
say fs_error
say
say fs_one"'"league_file || input2_file"'."
exit
end
if open(datafile2,league_file || input2_file,'r') then do
do while ~eof(datafile2)
line = readln(datafile2)
if pos(autosched,line) > 0 then
autos = 1
end
close(datafile2)
end
else do
say
say fs_error
say
say fs_two"'"league_file || input2_file"'."
exit
end
if autos = 1 then do
say
say fs_error
say
say fs_three
say fs_four
say fs_txt1
say
exit
end
say
say center(fs_txt2,78)
say "--------------------------------------------------------------------------"
say
say fs_txt3
say fs_txt4
say fs_txt5
say fs_txt6
say fs_txt7"'"league_file || output_file"'"
say fs_txt8
say
say fs_txt9
say
if open(datafile,league_file || input_file,'r') then do
if open(datafile2,league_file || output_file,'w') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(separator,line) = 0 then do
home = substr(line,1,30)
away = substr(line,41,30)
line = overlay(away,line,1)
line = overlay(home,line,41)
if pos(not_played,line) = 0 & words(line) > 0 then
line = overlay(not_played,line,32)
end
writeln(datafile2,line)
end
close(datafile2)
say fs_txt0
say fs_txta"'"league_file || output_file"'"fs_txtb
say
say
end
else do
say
say fs_error
say
say fs_txtc"'"league_file || output_file"'"fs_txtd
close(datafile)
exit
end
close(datafile)
end
else do
say
say fs_error
say
say fs_txtc"'"league_file || input_file"'"fx_txte
end
exit